/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package vernotte.alexandre.idm.projet.model.kaosgoalmodel.KaosGoalModel.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;

import vernotte.alexandre.idm.projet.model.kaosgoalmodel.KaosGoalModel.Agent;
import vernotte.alexandre.idm.projet.model.kaosgoalmodel.KaosGoalModel.Expectation;
import vernotte.alexandre.idm.projet.model.kaosgoalmodel.KaosGoalModel.KaosGoalModelPackage;
import vernotte.alexandre.idm.projet.model.kaosgoalmodel.KaosGoalModel.Requirement;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Agent</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link vernotte.alexandre.idm.projet.model.kaosgoalmodel.KaosGoalModel.impl.AgentImpl#getRequirement <em>Requirement</em>}</li>
 *   <li>{@link vernotte.alexandre.idm.projet.model.kaosgoalmodel.KaosGoalModel.impl.AgentImpl#getExpectation <em>Expectation</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class AgentImpl extends GoalModelElementImpl implements Agent {
	/**
	 * The cached value of the '{@link #getRequirement() <em>Requirement</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRequirement()
	 * @generated
	 * @ordered
	 */
	protected EList requirement;

	/**
	 * The cached value of the '{@link #getExpectation() <em>Expectation</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getExpectation()
	 * @generated
	 * @ordered
	 */
	protected EList expectation;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected AgentImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EClass eStaticClass() {
		return KaosGoalModelPackage.Literals.AGENT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList getRequirement() {
		if (requirement == null) {
			requirement = new EObjectWithInverseResolvingEList(Requirement.class, this, KaosGoalModelPackage.AGENT__REQUIREMENT, KaosGoalModelPackage.REQUIREMENT__AGENT);
		}
		return requirement;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList getExpectation() {
		if (expectation == null) {
			expectation = new EObjectWithInverseResolvingEList(Expectation.class, this, KaosGoalModelPackage.AGENT__EXPECTATION, KaosGoalModelPackage.EXPECTATION__AGENT);
		}
		return expectation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case KaosGoalModelPackage.AGENT__REQUIREMENT:
				return ((InternalEList)getRequirement()).basicAdd(otherEnd, msgs);
			case KaosGoalModelPackage.AGENT__EXPECTATION:
				return ((InternalEList)getExpectation()).basicAdd(otherEnd, msgs);
		}
		return super.eInverseAdd(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case KaosGoalModelPackage.AGENT__REQUIREMENT:
				return ((InternalEList)getRequirement()).basicRemove(otherEnd, msgs);
			case KaosGoalModelPackage.AGENT__EXPECTATION:
				return ((InternalEList)getExpectation()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case KaosGoalModelPackage.AGENT__REQUIREMENT:
				return getRequirement();
			case KaosGoalModelPackage.AGENT__EXPECTATION:
				return getExpectation();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case KaosGoalModelPackage.AGENT__REQUIREMENT:
				getRequirement().clear();
				getRequirement().addAll((Collection)newValue);
				return;
			case KaosGoalModelPackage.AGENT__EXPECTATION:
				getExpectation().clear();
				getExpectation().addAll((Collection)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eUnset(int featureID) {
		switch (featureID) {
			case KaosGoalModelPackage.AGENT__REQUIREMENT:
				getRequirement().clear();
				return;
			case KaosGoalModelPackage.AGENT__EXPECTATION:
				getExpectation().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case KaosGoalModelPackage.AGENT__REQUIREMENT:
				return requirement != null && !requirement.isEmpty();
			case KaosGoalModelPackage.AGENT__EXPECTATION:
				return expectation != null && !expectation.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //AgentImpl
